
/**
 * 登录
 */
function Login(params) {
	Ext.apply(this, params);
	this.lowerClassName = this.className.toLowerCase();
}

/**
 * 继承基类
 */
Login.prototype = new Base();

/**
 * 覆盖方法
 */
Login.prototype.showForm = function() {
	$('#divForm').empty();
	var login = this;
	
	login.formPanel = new Ext.form.FormPanel({
		id: 'form',
		title: login.formPanelTitle,
		frame: true,
		width: 400,
		labelWidth: 80,
		renderTo: 'divForm',
		items: login.formPanelItems,
		buttonAlign: 'center',
		buttons: [
			{text: '登录', id: 'btFormSave', handler: function() {
				Ext.getCmp('btFormSave').disable();
				Ext.getCmp('btFormReset').disable();
				
				login.formPanel.getForm().submit({
					url: '/szpxt/staff_login',
					success: function(form, action) {
						location.href = "/szpxt/finance/apply.jsp";		
					},
					failure: function(form, action) {
						Ext.getCmp('btFormSave').enable();
						Ext.getCmp('btFormReset').enable();
						
						switch(action.failureType) {
							case(Ext.form.Action.CONNECT_FAILURE):
								login.showErrorMessage('服务器连接失败！');
								break;
							case(Ext.form.Action.SERVER_INVALID):
								login.showErrorMessage('服务器检验数据失败！');
								break;
						}
						if(!action.result.success) {
							login.showErrorMessage('用户名或者密码错误！');
						}
					}
				})
			}},
			{text: '清空', id: 'btFormReset', scope: this, handler: function() {
				login.formPanel.getForm().reset();
			}}
		]
	})
	
	$('#divForm').show('slow');
}